﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iLangl.Model;
using iLangl.Transport.Communication;
using iLangl.LanguageWire.Managers;


namespace iLangl.LanguageWire.Actions
{
	public class OrderProjectAction : BaseLWAction
	{
		public OrderProjectAction()
			: base()
		{
			ResponseContext = new ProjectTPResponseContext();
			RequestContext = new ActionResultRequestContext();
		}


		protected override void _execute()
		{
			ProjectLW projectToRegister = new ProjectLW((Project)ResponseContext.GetContext());

			if (projectToRegister == null)
			{
				raiseAlert(new NullReferenceException());
			}

			try
			{
				ProjectManager.Instance.RegisterProject(projectToRegister);
			}
			catch (Exception ex)
			{
				raiseAlert(ex);
			}

		}

		protected override string GetName()
		{
			return "OrderProject";
		}

		protected override string GetVersion()
		{
			return "1";
		}
	}
}
